#! /usr/bin/env python
# -*- coding: utf-8 -*-

from django.conf.urls import url, include
from web.views import account, home, project, manage, file, setting
from web.views import issues
from web.views import wiki

urlpatterns = [
    # url(r'get_code/', views.get_code),
    url(r'register/$', account.register, name='register'),
    url(r'login/$', account.login, name='login'),
    url(r'logout/$', account.logout, name='logout'),
    url(r'image/code/$', account.image_code, name='image_code'),
    url(r'login/sms/$', account.login_sms, name='login_sms'),
    url(r'send/sms/$', account.send_sms, name='send_sms'),
    url(r'index/$', home.index, name='index'),
    # url(r'', home.index, name='index'),

    # 项目相关
    url(r"^project/list", project.project_list, name='project_list'),
    # project/star/my/1
    # project/star/join/1
    url(r'^project/star/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_star, name='project_star'),
    url(r'^project/unstar/(?P<project_type>\w+)/(?P<project_id>\d+)/$', project.project_unstar, name='project_unstar'),

    # 项目管理

    # url(r'manage/(?P<project_id>\d+)/dashboard/', ),
    # url(r'manage/(?P<project_id>\d+)/issues/', ),
    # url(r'manage/(?P<project_id>\d+)/statistics/', ),
    # url(r'manage/(?P<project_id>\d+)/file/', ),
    # url(r'manage/(?P<project_id>\d+)/wiki/', ),
    # url(r'manage/(?P<project_id>\d+)/setting/', ),

    url(r'^manage/(?P<project_id>\d+)/', include([
        url(r'^dashboard/$', manage.dashboard, name='dashboard'),

        url(r'^issues/$', issues.issues, name='issues'),
        url(r'^issues/detail/(?P<issues_id>\d+)/$', issues.detail, name='issues_detail'),
        url(r'^issues/record/(?P<issues_id>\d+)/$', issues.issues_record, name='issues_record'),
        url(r'^issues/change/(?P<issues_id>\d+)/$', issues.issues_change, name='issues_change'),

        url(r'^statistics/$', manage.statistics, name='statistics'),
        url(r'^file/$', file.file, name='file'),
        url(r'^file/post/$', file.file_post, name='file_post'),
        url(r'^file/delete$', file.file_delete, name='file_delete'),
        url(r'^file/download/(?P<file_id>\d+)/$', file.file_download, name='file_download'),
        url(r'^cos/cos_credential$', file.cos_credential, name='cos_credential'),

        url(r'^wiki/$', wiki.wiki, name='wiki'),
        url(r'^wiki/add/$', wiki.wiki_add, name='wiki_add'),
        url(r'^wiki/catalog/$', wiki.catalog, name='catalog'),
        url(r'^wiki/delete/(?P<wiki_id>\d+)/$', wiki.delete, name='wiki_delete'),
        url(r'^wiki/edit/(?P<wiki_id>\d+)/$', wiki.edit, name='wiki_edit'),
        url(r'^wiki/upload/$', wiki.upload, name='wiki_upload'),

        url(r'^setting/$', setting.setting, name='setting'),
        url(r'^setting/delete$', setting.setting_delete, name='setting_delete'),
    ], None, None)),

]
